setImportantForAutofill

Sets the mode for determining whether this view is considered important for autofill.

The platform determines the importance for autofill automatically but you can use this method to customize the behavior. For example:

  1. When the view contents is irrelevant for autofill (for example, a text field used in a "Captcha" challenge), it should be IMPORTANT_FOR_AUTOFILL_NO.
  2. When both the view and its children are irrelevant for autofill (for example, the root view of an activity containing a spreadhseet editor), it should be IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS.
  3. When the view content is relevant for autofill but its children aren't (for example, a credit card expiration date represented by a custom view that overrides the proper autofill methods and has 2 children representing the month and year), it should be IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS.

NOTE: setting the mode as does IMPORTANT_FOR_AUTOFILL_NO or IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS does not guarantee the view (and its children) will be always be considered not important; for example, when the user explicitly makes an autofill request, all views are considered important. See isImportantForAutofill for more details about how the View's importance for autofill is used.

This method is only supported on API >= 26. On API 25 and below, it is a no-op

Parameters